Send Mail
The MailUI module allows your script to present a native mail compose view, enabling users to send emails with recipients, subject, body, and attachments prefilled. It also provides a way to check whether the device is capable of sending emails.
The original Mail module is deprecated and has been replaced by MailUI.
MailUI.isAvailable: boolean
Returns true if the device is configured to send emails using the built-in Mail app.
MailUI.present(options): Promise<"cancelled" | "sent" | "failed" | "saved">
Presents the system mail composer with the provided options. Users can edit the message, then send, cancel, or save it as a draft.
Parameters
Attachment Object
Each attachment must include the following fields:
Return Value
Returns a Promise that resolves to one of the following result strings:
"sent"– The user sent the email."cancelled"– The user cancelled email composition."failed"– Sending failed due to an error (e.g., no email account configured)."saved"– The email was saved as a draft.
Throws
This method will throw an error if:
MailUI.isAvailableisfalse- The options are malformed or missing required fields
Example: Simple Email
Example: Email with Attachment
Notes
- The system mail composer must be presented in an interactive context (not in background-only scripts).
- The user controls the final sending of the message.
- This API requires a properly configured mail account.
